(global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/work/contract/add2" ], {
    "0944": function(t, n, r) {
        (function(i) {
            Object.defineProperty(n, "__esModule", {
                value: !0
            }), n.default = void 0;
            var t, e = r("26cb"), o = (t = r("a345")) && t.__esModule ? t : {
                default: t
            };
            function s(e, t) {
                var n, o = Object.keys(e);
                return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(e), t && (n = n.filter(function(t) {
                    return Object.getOwnPropertyDescriptor(e, t).enumerable;
                })), o.push.apply(o, n)), o;
            }
            function a(t, e, n) {
                return e in t ? Object.defineProperty(t, e, {
                    value: n,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : t[e] = n, t;
            }
            e = {
                components: {},
                data: function() {
                    return {
                        house: {},
                        t_user: {},
                        template: {},
                        money_type_list: [ {
                            id: 1,
                            name: "其他押金"
                        }, {
                            id: 2,
                            name: "周期费用"
                        }, {
                            id: 3,
                            name: "首期一次性费用"
                        } ],
                        contract_type_list: [ {
                            id: 1,
                            name: "电子合同"
                        }, {
                            id: 2,
                            name: "纸质合同"
                        } ],
                        form: {
                            house_id: 0,
                            type: 1,
                            pre_day: 30,
                            start_time: "",
                            end_time: "",
                            address: "",
                            contract_imgs: [],
                            sdq_imgs: [],
                            remarks: "",
                            f_name: "",
                            f_tel: "",
                            f_num: "",
                            f_imgs: [],
                            out_name: "",
                            t_id: 0,
                            t_name: "",
                            t_imgs: [],
                            t_tel: "",
                            t_num: ""
                        },
                        actionsheet_show: !1,
                        itemList: [],
                        actionsheet_tips: "",
                        other_list: [],
                        money_name_index: 0,
                        money_name_list: [ {
                            name: "管理费"
                        }, {
                            name: "宽带费"
                        }, {
                            name: "供暖费"
                        }, {
                            name: "服务费"
                        }, {
                            name: "分期手续费"
                        }, {
                            name: "租金补差"
                        }, {
                            name: "其他收费"
                        } ]
                    };
                },
                computed: function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var n = null != arguments[t] ? arguments[t] : {};
                        t % 2 ? s(Object(n), !0).forEach(function(t) {
                            a(e, t, n[t]);
                        }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : s(Object(n)).forEach(function(t) {
                            Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
                        });
                    }
                    return e;
                }({}, (0, e.mapState)({
                    staff: function(t) {
                        return t.user.staff;
                    }
                })),
                onLoad: function() {
                    var t = this.$Route.query;
                    this.form.house_id = t.house_id || 0, this.init();
                },
                onReady: function() {},
                beforeRouteLeave: function(t, e, n) {
                    console.info("leave"), n();
                },
                methods: (a(e = {
                    init: function() {
                        var n = this;
                        this.$api("store.contract_add2_init", {
                            house_id: n.form.house_id,
                            t_id: n.form.t_id
                        }).then(function(t) {
                            var e;
                            0 == t.errno && (e = t.data.house, n.house = e, t.data.template && (n.template = t.data.template), 
                            n.form.house_id = e.id, n.form.house_title = e.house_title, n.form.address = e.address, 
                            n.form.rent = e.rent, n.form.fu_month = e.fu_month, n.form.f_name = e.name, n.form.f_tel = e.tel, 
                            n.form.deposit = e.rent * e.ya_month, e = (0, o.default)().format("YYYY-MM-DD"), 
                            n.form.start_time = e, e = (0, o.default)().subtract(1, "days").add(1, "years").format("YYYY-MM-DD"), 
                            n.form.end_time = e);
                        });
                    },
                    add_other_item: function() {
                        this.other_list.push({
                            money_type: 2,
                            name: "物业费",
                            money: 100
                        });
                    },
                    delete_other_item: function(t) {
                        this.other_list.splice(t, 1);
                    },
                    select_money_name: function(t) {
                        var e = this;
                        this.money_name_index = t, this.actionsheet_tips = "选择";
                        var n = [];
                        this.money_name_list.forEach(function(t) {
                            t = {
                                text: t.name
                            };
                            n.push(t);
                        }), this.itemList = n, setTimeout(function() {
                            e.actionsheet_show = !0;
                        }, 50);
                    },
                    select_money_name_confirm: function(t) {
                        this.other_list[this.money_name_index].name = t.text, this.actionsheet_show = !1;
                    },
                    select_type: function(t) {
                        this.form.type = t;
                    },
                    select_zq_type: function(e) {
                        var n = this, o = [];
                        this.money_type_list.forEach(function(t) {
                            o.push(t.name);
                        }), i.showActionSheet({
                            itemList: o,
                            success: function(t) {
                                t = n.money_type_list[t.tapIndex];
                                n.other_list[e].money_type = t.id;
                            },
                            fail: function(t) {
                                console.log(t.errMsg);
                            }
                        });
                    }
                }, "select_type", function(t) {
                    this.form.type = t;
                }), a(e, "startDayChange", function(t) {
                    t = t.detail.value;
                    this.form.start_time = t;
                    t = (0, o.default)(t).subtract(1, "days").add(1, "years").format("YYYY-MM-DD");
                    this.form.end_time = t;
                }), a(e, "endDayChange", function(t) {
                    this.form.end_time = t.detail.value;
                }), a(e, "navToHouse", function() {}), a(e, "choose_house", function(t) {
                    this.form.house_id = t, this.init();
                }), a(e, "chooseTemplate", function() {
                    this.$Router.push({
                        path: "/pages/work/contract/select-template",
                        query: {}
                    });
                }), a(e, "onChooseImg", function(e, t) {
                    var n = this, t = t - e.length;
                    n.$tools.chooseImage(t).then(function(t) {
                        t.forEach(function(t) {
                            n.$tools.uploadFile("file.upload", t).then(function(t) {
                                e.push(t.url);
                            });
                        });
                    });
                }), a(e, "delImg", function(e, n) {
                    i.showModal({
                        title: "删除照片",
                        content: "确定要删除这张照片么？",
                        cancelText: "取消",
                        confirmText: "删除",
                        success: function(t) {
                            t.confirm && e.splice(n, 1);
                        }
                    });
                }), a(e, "contract_pre", function() {
                    var t, e = this.form;
                    this.template.id ? (i.showLoading({
                        title: "正在提交"
                    }), this.$api("work.contract_add2_see", (a(t = {
                        house_id: e.house_id,
                        house_title: e.house_title,
                        address: e.address,
                        f_imgs: e.f_imgs.join(","),
                        f_tel: e.f_tel,
                        f_name: e.f_name
                    }, "f_tel", e.f_tel), a(t, "f_num", e.f_num), a(t, "t_imgs", e.t_imgs.join(",")), 
                    a(t, "t_tel", e.t_tel), a(t, "t_name", e.t_name), a(t, "t_tel", e.t_tel), a(t, "t_num", e.t_num), 
                    a(t, "fu_month", e.fu_month), a(t, "deposit", e.deposit), a(t, "rent", e.rent), 
                    a(t, "pre_day", e.pre_day), a(t, "start_time", e.start_time), a(t, "end_time", e.end_time), 
                    a(t, "other_list", JSON.stringify(this.other_list)), a(t, "template_id", this.template.id), 
                    t), "post").then(function(t) {
                        0 == t.errno && (t = t.data.url, i.downloadFile({
                            url: t,
                            success: function(t) {
                                t = t.tempFilePath;
                                i.openDocument({
                                    filePath: t,
                                    showMenu: !0,
                                    success: function(t) {
                                        console.log("打开成功");
                                    },
                                    fail: function(t) {
                                        console.log(t);
                                    }
                                });
                            },
                            fail: function(t) {
                                console.log(t);
                            },
                            complete: function(t) {
                                i.hideLoading();
                            }
                        }));
                    })) : this.$tools.toast("请选择数据模板");
                }), a(e, "bill_pre", function() {
                    var t = this.form;
                    this.template.id ? t.rent <= 0 ? this.$tools.toast("租金不能为空") : this.$Router.push({
                        path: "/pages/work/contract/bill-list",
                        query: {
                            rent: t.rent,
                            deposit: t.deposit,
                            pre_day: t.pre_day,
                            fu_month: t.fu_month,
                            start_time: t.start_time,
                            end_time: t.end_time,
                            other_list: JSON.stringify(this.other_list)
                        }
                    }) : this.$tools.toast("请选择数据模板");
                }), a(e, "formSubmit", function(t) {
                    var e, n = this, o = this.form;
                    1 != this.form.type || n.template.id ? 2 != this.form.type || 0 != n.form.contract_imgs.length ? o.t_name ? o.t_tel ? o.rent ? (i.showLoading({
                        mask: !0,
                        title: "正在提交"
                    }), n.$api("contract.contract_new", (a(e = {
                        // staff_id: n.staff.id,
                        house_id: o.house_id,
                        house_title: o.house_title,
                        address: o.address,
                        contract_imgs: o.contract_imgs.join(","),
                        sdq_imgs: o.sdq_imgs.join(","),
                        f_imgs: o.f_imgs.join(","),
                        f_tel: o.f_tel,
                        f_name: o.f_name
                    }, "f_tel", o.f_tel), a(e, "f_num", o.f_num), a(e, "t_imgs", o.t_imgs.join(",")), 
                    a(e, "t_tel", o.t_tel), a(e, "t_name", o.t_name), a(e, "t_tel", o.t_tel), a(e, "t_num", o.t_num), 
                    a(e, "fu_month", o.fu_month), a(e, "deposit", o.deposit), a(e, "rent", o.rent), 
                    a(e, "pre_day", o.pre_day), a(e, "out_name", o.out_name), a(e, "start_time", o.start_time), 
                    a(e, "end_time", o.end_time), a(e, "type", o.type), a(e, "template_id", n.template.id), 
                    a(e, "other_list", JSON.stringify(n.other_list)), e), "post").then(function(t) {
                        i.hideLoading(), 0 == t.errno ? 0 == t.data.code ? (n.$tools.toast("提交成功"), setTimeout(function() {
                            n.$Router.replace({
                                path: "/pages/work/house/list"
                            });
                        }, 500)) : n.$tools.toast(t.data.msg) : n.$tools.toast("异常");
                    })) : n.$tools.toast("请填写租金") : n.$tools.toast("请填写租客电话") : n.$tools.toast("请填写租客姓名") : n.$tools.toast("请上传合同照片") : n.$tools.toast("请选择数据模板");
                }), e)
            };
            n.default = e;
        }).call(this, r("543d").default);
    },
    "342c": function(t, e, n) {
        n.d(e, "b", function() {
            return i;
        }), n.d(e, "c", function() {
            return s;
        }), n.d(e, "a", function() {
            return o;
        });
        var o = {
            wkLoginModal: function() {
                return n.e("components/wk-login-modal/index").then(n.bind(null, "978a"));
            },
            wkActionsheet: function() {
                return n.e("components/wk-actionsheet/index").then(n.bind(null, "11e1"));
            }
        }, i = function() {
            var e = this;
            e.$createElement;
            e._self._c, e._isMounted || (e.e0 = function(t) {
                e.actionsheet_show = !1;
            });
        }, s = [];
    },
    "5c8d": function(t, e, n) {},
    "9dc0": function(t, e, o) {
        (function(t) {
            o("767a"), n(o("66fd"));
            var e = n(o("d52f"));
            function n(t) {
                return t && t.__esModule ? t : {
                    default: t
                };
            }
            wx.__webpack_require_UNI_MP_PLUGIN__ = o, t(e.default);
        }).call(this, o("543d").createPage);
    },
    bffd: function(t, e, n) {
        n.r(e);
        var o, i = n("0944"), s = n.n(i);
        for (o in i) "default" !== o && function(t) {
            n.d(e, t, function() {
                return i[t];
            });
        }(o);
        e.default = s.a;
    },
    d52f: function(t, e, n) {
        n.r(e);
        var o, i = n("342c"), s = n("bffd");
        for (o in s) "default" !== o && function(t) {
            n.d(e, t, function() {
                return s[t];
            });
        }(o);
        n("f1b0");
        var a = n("f0c5"), i = Object(a.a)(s.default, i.b, i.c, !1, null, null, null, !1, i.a, void 0);
        e.default = i.exports;
    },
    f1b0: function(t, e, n) {
        var o = n("5c8d");
        n.n(o).a;
    }
}, [ [ "9dc0", "common/runtime", "common/vendor" ] ] ]);